package com.doitedu.day05

/**
 * @Date 22.6.25
 * @Created by HANGGE
 * @Description
 */
object _01ReduceDemo {
  def main(args: Array[String]): Unit = {
    val  ls = List[Int](1,2,3,4,5)
   // 聚合  求和
    val sum1 = ls.reduce(_ + _)
    println(sum1)
    // 默认值参与计算  默认值是返回值类型
    val sum2 = ls.aggregate(" ")(_ + _, _ + _)
    println(sum2)
  }

}
